<?php
/**
 * Created by PhpStorm.
 * User: xiaoxin
 * Date: 2018/10/26 0026
 * Time: 9:22
 */
include './functions.php';
include "./Db.php";
$post = $_POST;
session_start();
$db = new Db('card');
$res = $db->find($post['id']);
if (!isset($_SESSION['username'])){
	exit(json_encode(['code'=>1,'msg'=>'请先登陆']));
}
if ($res['username']!=$_SESSION['username']){
	exit(json_encode(['code'=>1,'msg'=>'你没有权限']));
}
$db->where('card_id=\''.$post['id']);
unset($post['id']);
$ress = $db->update($post);
if ($ress){
	exit(json_encode(['code'=>0,'msg'=>'保存成功']));
}
